<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <script type="text/javascript">
        	function loadJS(){
        		(function(doc){
				    //var t = parseInt((new Date()).getTime() / 1000);
				    var t = 1407744117;
				    var v = t - t % 300;
				    var js = doc.createElement("script"); 
					    js.charset = "utf-8";
				        //js.src = "http://d189.mzhen.cn/static/adserving/mz_ad_serving.js?v=" + v;
				        js.src = "semi_ad_serving.js?v=" + v;
				    var fs = doc.getElementsByTagName('script')[0]; 
					fs.parentNode.insertBefore(js, fs);
				})(document);
				
				var pid = document.getElementById("pid").value;
				var width = document.getElementById("w").value;
                var height = document.getElementById("h").value;
                
                var k1 = document.getElementById("k1").value;
                var k2 = document.getElementById("k2").value;
                var k3 = document.getElementById("k3").value;
                
                var max = document.getElementById("max").value;
                var showtype = document.getElementById("showtype").value;
                var time = document.getElementById("time").value;
                var arraytype = document.getElementById("arraytype").value;
                var code = document.getElementById("code").value;
                
                var user = document.getElementById("user").value;
                var ip = document.getElementById("ip").value;
                var src = document.getElementById("src").value;
                var ldp = document.getElementById("ldp").value;
                var timeout = document.getElementById("timeout").value;

                if (!width || !height || !pid) {
                    return;
                }
                
                (function (win) {
				    var params = {};
				    params["_srv"] = "GOME";
				    params["_id"] = "GOME_1";
				    
				    params["l"] = pid;
				    params["w"] = width;
				    params["h"] = height;
				    
				    params["k1"] = k1;
				    params["k2"] = k2;
				    params["k3"] = k3;
				    
				    params["max"] = max;
				    params["showtype"] = showtype;
				    params["time"] = time;
				    params["arraytype"] = arraytype;
				    params["code"] = code;
				    
				    params["user"] = user;
				    params["ip"] = ip;
				    
				    params["src"] = src;
				    params["ldp"] = ldp;
				    params["timeout"] = timeout;
		
				    __semi_rpq = win.__semi_rpq || [];
				    __semi_rpq.push(params);
				})(window);
        	}
            function loadFrame() {
                var div = document.getElementById("iframe");
				
                var pid = document.getElementById("pid").value;
                var width = document.getElementById("w").value;
                var height = document.getElementById("h").value;
                
                var k1 = document.getElementById("k1").value;
                var k2 = document.getElementById("k2").value;
                var k3 = document.getElementById("k3").value;
                
                var max = document.getElementById("max").value;
                var showtype = document.getElementById("showtype").value;
                var time = document.getElementById("time").value;
                var arraytype = document.getElementById("arraytype").value;
                var code = document.getElementById("code").value;
                
                var user = document.getElementById("user").value;
                var ip = document.getElementById("ip").value;
                var src = document.getElementById("src").value;
                var ldp = document.getElementById("ldp").value;
                var timeout = document.getElementById("timeout").value;

                if (!width || !height || !pid) {
                    return;
                }

                //var url = "http://d189.mzhen.cn/static/adserving/mzad_iframe.html?_srv=GOME&l=" + pid;
                var url = "semiad_iframe.html?_srv=GOME&l=" + pid;

                if (user)
                    url += "&user=" + user;
                
                if (ip)
                    url += "&ip=" + ip;
				
				url += "&k1=" + k1;
				url += "&k2=" + k2;
				url += "&k3=" + k3;
				
                url += "&src=" + src;
                url += "&ldp=" + ldp;
                url += "&w=" + width;
                url += "&h=" + height;
                url += "&timeout=" + timeout;
                url += "&max=" + max;
                url += "&showtype=" + showtype;
                url += "&time=" + time;
                url += "&arraytype=" + arraytype;
                url += "&code=" + code;

                var newFrame = document.createElement("iframe");
                newFrame.setAttribute("width", width);
                newFrame.setAttribute("height", height);
                newFrame.setAttribute("frameborder", "0");
                newFrame.setAttribute("marginheight", "0");
                newFrame.setAttribute("marginwidth", "0");
                newFrame.setAttribute("scrolling", "no");
                newFrame.setAttribute("allowTransparency", "true");

                newFrame.setAttribute("src", url);

                var objs = document.getElementsByTagName("iframe");
                for (var i = 0; i < objs.length; i++) {
                    div.removeChild(objs[i]);
                }

                div.appendChild(newFrame);
            }
        </script>
    </head>
    <body>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">广告位ID</span> <input type="text" id="pid" value="103" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">宽</span> <input type="text" id="w" value="256" style="width:400px;"> </input></div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">高</span> <input type="text" id="h" value="256" style="width:400px;"/> </div>
        
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">关键字1</span> <input type="text" id="k1" value="关键字1" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">关键字2</span> <input type="text" id="k2" value="关键字2" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">关键字3</span> <input type="text" id="k3" value="关键字3" style="width:400px;"/> </div>
        
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">分栏</span> <input type="text" id="max" value="3" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">展示类型</span> <input type="text" id="showtype" value="1" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">切换时间</span> <input type="text" id="time" value="2000" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">布局方式</span> <label><input type="radio" id="arraytype" value="0" checked="checked" />水平布局</label><label><input type="radio" id="arraytype" value="1"/>垂直布局</label> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">模板代码</span> <input type="text" id="code" value="2000" style="width:400px;"/> </div>
        
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">用户ID</span> <input type="text" id="user" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">IP</span> <input type="text" id="ip" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">默认物料</span> <input type="text" id="src" value="http://d189.mzhen.cn/static/trp/images/logo.jpg" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">默认跳转</span> <input type="text" id="ldp" value="http://www.semidata.com" style="width:400px;"/> </div>
        <div style="margin: 5px;"> <span style="width:100px;display:inline-block">超时设置</span> <input type="text" id="timeout" value="1000" style="width:400px;"/> </div>

        <div style="margin: 5px;"> <button type="button" style="width:60px; height:20px;" onClick="javascript:loadJS()">JavaScript投放</button> </div>
        <div style="margin: 5px;"> <button type="button" style="width:60px; height:20px;" onClick="javascript:loadFrame()">Iframe投放</button> </div>

        <div  style="margin: 5px;" id="iframe"></div>
        <div id="GOME_1"></div>
        
    </body>
</html>
